package dal.project_team;

import java.sql.PreparedStatement;

import dal.database.DBUtil;

public class ProjectTeamMemberUtil {
	
public boolean add(Object instance){
		
		boolean isOk=false;
		ProjectTeamMember projectTeamMember=(ProjectTeamMember)instance;
		
		String qry="insert into project_team_members values(?,?,?)";
		System.out.println(qry);
		
		try {
			
			PreparedStatement preparedStatement=DBUtil.getCon().prepareStatement(qry);
			
			preparedStatement.setString(1,projectTeamMember.getTeamId());
			preparedStatement.setString(2,projectTeamMember.getEmployeeId());
			preparedStatement.setString(3,projectTeamMember.getRole());			
			System.out.println("In Util"+projectTeamMember.getTeamId()+""+projectTeamMember.getEmployeeId()+""+projectTeamMember.getRole());
			
			int res=preparedStatement.executeUpdate();
			
			if(res>0){
				isOk=true;
			}
			else{
				isOk=false;
			}
			
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
		}
		
		return isOk;
		
		
	}

}
